﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace EMSClient.CForm.Uc
{
    public partial class UcShowWenShiDu : UserControl
    {
        public UcShowWenShiDu()
        {
            InitializeComponent();
        }


        public UcShowWenShiDu(UcShowWenShiDuDto dto, bool isInit = true)
        {
            InitializeComponent();

            ucMeter4.Value = dto.WenDu;
            ucThermometer4.Value = dto.ShiDu;
            label1.Text = "序号 " + dto.Index;

            if (isInit)
            {
                label2.Text = "-";
                label3.Text = "-";
            }
            else
            {
                label2.Text = "" + dto.WenDu;
                label3.Text = "" + dto.ShiDu;
            }
        }

        public void SetVal(UcShowWenShiDuDto dto)
        {
            label1.Text = "序号 " + dto.Index;

            if (dto.ShiDu > 100) { dto.ShiDu = 0; }
            if (dto.WenDu > 100) { dto.WenDu = 0; }
 
            ucMeter4.Value = dto.ShiDu; 
            ucThermometer4.Value = dto.WenDu;
             
            label2.Text = "" + dto.WenDu;
            label3.Text = "" + dto.ShiDu;

        }
    }

    public class UcShowWenShiDuDto
    {
        public int Index { get; set; }
        public decimal WenDu { get; set; }
        public decimal ShiDu { get; set; }

    }

}
